//
//  NBCURLRouter.h
//  NBCURLRouterDemo
//
//  Created by naruto on 16/8/17.
//  Copyright © 2016年 naruto. All rights reserved.
//  核心类 通过调用类方法实现自定义URL跳转

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NBCURLRouter : NSObject

#pragma mark - system

/**
 获取共享的URLRouter实例

 @return NBCURLRouter
 */
+ (NBCURLRouter *)shareURLRouter;

#pragma mark - 注册 vc的scheme

/**
 绑定vc和scheme，建立隐射关系

 @param vcClass vc class
 @param scheme 唯一标识符
 */
-(void)registerScheme:(NSString *)vcClass scheme:(NSString *)scheme;


#pragma mark - push vc
/**
 *  push方式弹入 vc
 *
 *  @param viewController 目标控制器
 *  @param animated 是否需要动画参数
 */
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;

/**
 *  push方式弹入 vc
 *
 *  @param urlString 自定义的URL,可以拼接参数
 *  @param animated 是否需要动画参数
 */
- (void)pushURLString:(NSString *)urlString animated:(BOOL)animated;

/**
 *  push方式弹入 vc
 *
 *  @param urlString 自定义URL,也可以拼接参数,但会被下面的query替换掉
 *  @param query     存放参数
 *  @param animated 是否需要动画参数
 */
- (void)pushURLString:(NSString *)urlString query:(NSDictionary *)query animated:(BOOL)animated;


#pragma mark - pop vc

/**
 pop方式弹出一个vc
 
 @param animated 是否需要动画参数
 */
- (void)popViewControllerAnimated:(BOOL)animated;
/**
 pop方式弹出到根vc，显示根vc
 
 @param animated 是否需要动画参数
 */
- (void)popToRootViewControllerAnimated:(BOOL)animated;

#pragma mark - present vc

/**
 *  modal 方式打开vc
 *
 *  @param viewControllerToPresent 目标控制器
 */
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)animated completion:(void (^ __nullable)(void))completion;
/**
 *  modal 方式打开vc
 *
 *  @param urlString 自定义的URL,可以拼接参数
 */
- (void)presentURLString:(NSString *)urlString animated:(BOOL)animated completion:(void (^ __nullable)(void))completion;

/**
 *  modal 方式打开vc
 *
 *  @param urlString 自定义URL,也可以拼接参数,但会被下面的query替换掉
 *  @param query     存放参数
 */
- (void)presentURLString:(NSString *)urlString query:(NSDictionary *)query animated:(BOOL)animated completion:(void (^ __nullable)(void))completion;

#pragma mark - dismiss vc

/**
 dismiss方式弹出 到当前根vc
 
 @param animated 是否需要动画
 @param completion 完成回调action
 */
- (void)dismissViewControllerAnimated: (BOOL)animated completion: (void (^ __nullable)(void))completion;
/**
 dismiss方式弹出 到当前根vc
 
 @param animated 是否需要动画
 @param completion 完成回调action
 */
- (void)dismissToRootViewControllerAnimated: (BOOL)animated completion: (void (^ __nullable)(void))completion;

NS_ASSUME_NONNULL_END
@end
